#ifndef OS_MUTEX_H
#define OS_MUTEX_H

#include <windows.h>
#include "Uncopyable.h"

class OSMutex : private Uncopyable
{
public:
	OSMutex();
	virtual ~OSMutex();

	bool Acquire() const;
	bool Release() const;

	class Lock : private Uncopyable
	{
	public:
		Lock(const OSMutex&);
		Lock(const OSMutex*);
		~Lock();

	private:
		void DoAcquire();
		const OSMutex* mpMutex;
	};

	class Unlock : private Uncopyable
	{
	public:
		Unlock(const OSMutex&);
		Unlock(const OSMutex*);
		~Unlock();

	private:
		void DoRelease();
		const OSMutex* mpMutex;
	};

private:
	HANDLE	mHandle;
};

#endif